package com.atguigu.jdkOnePointEight;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Guo 2022/9/7 10:48:26
 */
public class lambda {

    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("a","a");
        map.put("b","b");
        map.put("c","c");
        map.put("d","d");

        map.forEach((k,v) -> {
            System.out.println("k=" + k + " v=" + v);
        });


        List<String> list = new ArrayList<String>();
        list.add("a");
        list.add("bb");
        list.add("ccc");
        list.add("dddd");

        list.forEach(System.out::println);


        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                System.out.println("普通方式创建!");
            }
        };
        //使用拉姆达方式创建
        Runnable r2 = ()-> System.out.println("拉姆达方式创建!");

        r1.run();
        r2.run();


    }
}
